package 笔试.A百度;

import java.util.HashSet;

public class forth {
    public static void main(String arg[]){//main--来自高金磊
        int[] nums=new int[]{7,5,4};
        HashSet<Integer> data=new HashSet<>();
        data.add(0);
        int room_len=8;
        int count=0;
        while(room_len>0){
            count++;
            int middle=room_len;
            for (int num : nums) {
                if (data.contains(room_len%num)){
                    room_len-=room_len;
                    break;
                }
            }
            if (middle==room_len)
                room_len-=nums[nums.length-1];
        }
        if (room_len!=0)
            count=-1;
        System.out.println(count);
    }

}
